home *** CD-ROM | disk | FTP | other *** search
/ mail.altrad.com / 2015.02.mail.altrad.com.tar / mail.altrad.com / TEST / office deutch / OUTLOOK.NL-NL / OUTLKLR.CAB / OUTLLIBR.DLL_1043 / HTML / INTERCONNECT_BIZCARD.XSL next >
Extensible Markup Language  |  2006-11-13  |  16KB  |  367 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- _localBinding -->
  3. <!-- _lcid="1043" _version="" -->
  4.  
  5.  
  6. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:rmsst="urn:schemas-microsoft-com:office:rms">
  7.     
  8. <xsl:template match="/">
  9.     <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
  10.         <xsl:element name="head">
  11.             <xsl:element name="style">v\:* { behavior: url(#default#VML); } o\:* { behavior: url(#default#VML); }</xsl:element>
  12.         </xsl:element>
  13.         <xsl:element name="body">
  14.             <xsl:attribute name="style">margin:0 0 0 0;padding:0 0 0 0;border:0 none #FFFFFF;overflow:hidden;</xsl:attribute>
  15.             <div>
  16.             <xsl:apply-templates/>
  17.             </div>
  18.         </xsl:element>
  19.     </html>
  20. </xsl:template>
  21.  
  22. <xsl:template match="design">
  23.     <xsl:element name="div">
  24.         <xsl:attribute name="style">
  25.             <xsl:text>position:absolute;</xsl:text>
  26.             <xsl:text>text-align:left;</xsl:text>
  27.             <xsl:text>overflow:hidden;</xsl:text>
  28.             <xsl:text>width:</xsl:text><xsl:value-of select="./information/style/width"/><xsl:text>;</xsl:text>
  29.             <xsl:text>height:</xsl:text><xsl:value-of select="./information/style/height"/><xsl:text>;</xsl:text>
  30.             <xsl:choose>
  31.                 <xsl:when test="./information/style/background/color!=''">
  32.                     <xsl:text>background-color:</xsl:text><xsl:value-of select="./information/style/background/color"/><xsl:text>;</xsl:text>
  33.                 </xsl:when>
  34.                 <xsl:otherwise>
  35.                     <xsl:text>background-color:#FFFFFF;</xsl:text>
  36.                 </xsl:otherwise>
  37.             </xsl:choose>
  38.             <xsl:if test="./information/style/border">
  39.                 <xsl:text>border:</xsl:text><xsl:value-of select="./information/style/border"/><xsl:text>;</xsl:text>
  40.             </xsl:if>
  41.         </xsl:attribute>
  42.  
  43.         <xsl:if test="./information/style/background/imagedata!=''">
  44.             <v:shape>
  45.                 <xsl:attribute name="coordsize">21600,21600</xsl:attribute>
  46.                 <xsl:attribute name="path">m 1,1 l 21600,1 21600,21600, 1,21600 x e</xsl:attribute>
  47.                 <xsl:attribute name="style">
  48.                     <xsl:text>position:absolute;</xsl:text>
  49.                     <xsl:text>width:</xsl:text><xsl:value-of select="./information/style/width"/><xsl:text>;</xsl:text>
  50.                     <xsl:text>height:</xsl:text><xsl:value-of select="./information/style/height"/><xsl:text>;</xsl:text>
  51.                 </xsl:attribute>
  52.  
  53.                 <v:fill>
  54.                     <xsl:attribute name="type">tile</xsl:attribute>
  55.                     <xsl:attribute name="src"><xsl:value-of select="./information/style/background/imagedata/src"/></xsl:attribute>
  56.                 </v:fill>
  57.             </v:shape>
  58.         </xsl:if>
  59.  
  60.         <xsl:choose>
  61.             <xsl:when test="/design/information/page">
  62.                 <xsl:apply-templates select="./page"/>
  63.             </xsl:when>
  64.             <xsl:otherwise>
  65.                 <xsl:apply-templates select="./object"/>
  66.             </xsl:otherwise>
  67.         </xsl:choose>
  68.  
  69.         <v:shape>
  70.             <xsl:attribute name="coordsize">21600,21600</xsl:attribute>
  71.             <xsl:attribute name="path">m 1,1 l 21600,1 21600,21600, 1,21600 x e</xsl:attribute>
  72.             <xsl:attribute name="style">
  73.                 <xsl:text>position:absolute;</xsl:text>
  74.                 <xsl:text>width:</xsl:text><xsl:value-of select="./information/style/width"/><xsl:text>;</xsl:text>
  75.                 <xsl:text>height:</xsl:text><xsl:value-of select="./information/style/height"/><xsl:text>1;</xsl:text>
  76.             </xsl:attribute>
  77.             <xsl:attribute name="filled">false</xsl:attribute>
  78.             <xsl:attribute name="stroked">false</xsl:attribute>
  79.         </v:shape>
  80.     </xsl:element>
  81. </xsl:template>
  82.  
  83. <xsl:template match="information">
  84. </xsl:template>
  85.  
  86. <xsl:template match="page[@no=/design/information/page]">
  87.     <xsl:apply-templates select="./*"/>
  88. </xsl:template>
  89.  
  90. <xsl:template match="page">
  91. </xsl:template>
  92.  
  93. <xsl:template match="object[@type='line']">
  94.     <v:line>
  95.         <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
  96.         <xsl:attribute name="objtype"><xsl:value-of select="@type"/></xsl:attribute>
  97.         <xsl:attribute name="style">position:absolute;<xsl:apply-templates select="./style"/></xsl:attribute>
  98.  
  99.         <xsl:if test="./from">
  100.             <xsl:attribute name="from"><xsl:value-of select="./from"/></xsl:attribute>
  101.         </xsl:if>
  102.  
  103.         <xsl:if test="./to">
  104.             <xsl:attribute name="to"><xsl:value-of select="./to"/></xsl:attribute>
  105.         </xsl:if>
  106.         
  107.         <xsl:if test="./strokecolor">
  108.             <xsl:attribute name="strokecolor"><xsl:value-of select="./strokecolor"/></xsl:attribute>
  109.         </xsl:if>
  110.  
  111.         <xsl:if test="./strokeweight">
  112.             <xsl:attribute name="strokeweight"><xsl:value-of select="./strokeweight"/></xsl:attribute>
  113.         </xsl:if>
  114.  
  115.         <xsl:if test="./stroked">
  116.             <xsl:attribute name="stroked"><xsl:value-of select="./stroked"/></xsl:attribute>
  117.         </xsl:if>
  118.     </v:line>
  119. </xsl:template>
  120.  
  121. <xsl:template match="object">
  122.     <xsl:if test="not(string(@visible)='false')">
  123.         <xsl:choose>
  124.             <xsl:when test="./imagedata and ./href">
  125.                 <rmsst:webpage>
  126.                     <xsl:call-template name="renderShape"/>
  127.                     <xsl:element name="span">
  128.                         <xsl:attribute name="style">display:none;</xsl:attribute>
  129.                         <xsl:value-of select="./href"/>
  130.                     </xsl:element>
  131.                 </rmsst:webpage>
  132.             </xsl:when>
  133.             <xsl:otherwise>
  134.                 <xsl:call-template name="renderShape"/>
  135.             </xsl:otherwise>
  136.         </xsl:choose>
  137.     </xsl:if>
  138. </xsl:template>
  139.  
  140. <xsl:template name="renderShape">
  141.     <v:shape>
  142.         <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
  143.         <xsl:attribute name="objtype"><xsl:value-of select="@type"/></xsl:attribute>
  144.         <xsl:attribute name="style"><xsl:apply-templates select="./style"/></xsl:attribute>
  145.  
  146.         <xsl:if test="./filled">
  147.             <xsl:attribute name="filled"><xsl:value-of select="./filled"/></xsl:attribute>
  148.         </xsl:if>
  149.  
  150.         <xsl:if test="./stroked">
  151.             <xsl:attribute name="stroked"><xsl:value-of select="./stroked"/></xsl:attribute>
  152.         </xsl:if>
  153.  
  154.         <xsl:if test="./fillcolor">
  155.             <xsl:attribute name="fillcolor"><xsl:value-of select="./fillcolor"/></xsl:attribute>
  156.         </xsl:if>
  157.  
  158.         <xsl:if test="./strokecolor">
  159.             <xsl:attribute name="strokecolor"><xsl:value-of select="./strokecolor"/></xsl:attribute>
  160.         </xsl:if>
  161.  
  162.         <xsl:if test="./strokeweight">
  163.             <xsl:attribute name="strokeweight"><xsl:value-of select="./strokeweight"/></xsl:attribute>
  164.         </xsl:if>
  165.  
  166.         <xsl:if test="./stroked[.='false']">
  167.             <xsl:attribute name="stroked">false</xsl:attribute>
  168.         </xsl:if>
  169.  
  170.         <xsl:attribute name="coordsize">21600,21600</xsl:attribute>
  171.  
  172.         <xsl:choose>
  173.             <xsl:when test="./spt">
  174.                 <xsl:attribute name="o:spt"><xsl:value-of select="./spt"/></xsl:attribute>
  175.                 <xsl:attribute name="ospt"><xsl:value-of select="./spt"/></xsl:attribute>
  176.             </xsl:when>
  177.             <xsl:otherwise>
  178.                 <xsl:attribute name="path">m 1,1 l 21600,1 21600,21600, 1,21600 x e</xsl:attribute>
  179.             </xsl:otherwise>
  180.         </xsl:choose>
  181.  
  182.         <xsl:if test="./imagedata">
  183.             <xsl:apply-templates select="./imagedata"/>
  184.         </xsl:if>
  185.             
  186.         <xsl:if test="./photofilepath">
  187.             <xsl:apply-templates select="./photofilepath"/>
  188.         </xsl:if>
  189.  
  190.         <xsl:if test="./textbox">
  191.             <xsl:choose>
  192.                 <xsl:when test="./@type='full_name'">
  193.                     <rmsst:fullname>
  194.                         <xsl:call-template name="renderTextBox"/>
  195.                     </rmsst:fullname>
  196.                 </xsl:when>
  197.                 <xsl:when test="./@type='business_email' or ./@type='home_email' or ./@type='other_email'">
  198.                     <rmsst:email>
  199.                         <xsl:call-template name="renderTextBox"/>
  200.                     </rmsst:email>
  201.                 </xsl:when>
  202.                 <xsl:when test="./@type='business_address' or ./@type='home_address' or ./@type='other_address'">
  203.                     <rmsst:address>
  204.                         <xsl:call-template name="renderTextBox"/>
  205.                     </rmsst:address>
  206.                 </xsl:when>
  207.                 <xsl:when test="./@type='company'">
  208.                     <rmsst:companyname>
  209.                         <xsl:call-template name="renderTextBox"/>
  210.                     </rmsst:companyname>
  211.                 </xsl:when>
  212.                 <xsl:when test="./@type='url' or ./@type='home_url'">
  213.                     <rmsst:webpage>
  214.                         <xsl:call-template name="renderTextBox"/>
  215.                     </rmsst:webpage>
  216.                 </xsl:when>
  217.                 <xsl:otherwise>
  218.                     <xsl:call-template name="renderTextBox"/>
  219.                 </xsl:otherwise>
  220.             </xsl:choose>
  221.         </xsl:if>
  222.     </v:shape>
  223. </xsl:template>
  224.  
  225. <xsl:template name="renderTextBox">
  226.     <xsl:element name="v:textbox">
  227.         <xsl:if test="./textbox/inset">
  228.             <xsl:attribute name="inset"><xsl:value-of select="./textbox/inset"/></xsl:attribute>
  229.         </xsl:if>
  230.         <xsl:element name="span">
  231.             <xsl:attribute name="style"><xsl:call-template name="textboxstyle"></xsl:call-template></xsl:attribute>
  232.  
  233.             <xsl:if test="@prefix">
  234.                 <xsl:call-template name="encodeNbsp">
  235.                     <xsl:with-param name="text" select="@prefix"/>
  236.                 </xsl:call-template>
  237.                 <xsl:text disable-output-escaping="yes">&#160;</xsl:text>
  238.             </xsl:if>
  239.  
  240.             <xsl:choose>
  241.                 <xsl:when test="./textbox/textdata/rowdata">
  242.                     <xsl:apply-templates select="./textbox/textdata/rowdata"><xsl:sort select="rowindex"/></xsl:apply-templates>
  243.                 </xsl:when>
  244.                 <xsl:otherwise>
  245.                     <xsl:call-template name="encodeNbsp">
  246.                         <xsl:with-param name="text" select="./textbox/textdata"/>
  247.                     </xsl:call-template>
  248.                 </xsl:otherwise>
  249.             </xsl:choose>
  250.  
  251.             <xsl:if test="@suffix">
  252.                 <xsl:text disable-output-escaping="yes">&#160;</xsl:text>
  253.                 <xsl:call-template name="encodeNbsp">
  254.                     <xsl:with-param name="text" select="@suffix"/>
  255.                 </xsl:call-template>
  256.             </xsl:if>
  257.         </xsl:element>
  258.     </xsl:element>
  259. </xsl:template>
  260.  
  261. <xsl:template name="textboxstyle">
  262.     <xsl:text>overflow:hidden;word-wrap:break-word;</xsl:text>
  263.     <xsl:if test="contains(./style/width,'px')">width:<xsl:value-of select="number(substring-before(./style/width,'px'))-4"/>px;</xsl:if>
  264.     <xsl:if test="contains(./style/height,'px')">height:<xsl:value-of select="number(substring-before(./style/height,'px'))-4"/>px;</xsl:if>
  265.     <xsl:if test="./textbox/style/font">font:<xsl:value-of select="./textbox/style/font"/>;</xsl:if>
  266.     <xsl:if test="./textbox/style/font-family">font-family:<xsl:value-of select="./textbox/style/font-family"/>;</xsl:if>
  267.     <xsl:if test="./textbox/style/font-weight">font-weight:<xsl:value-of select="./textbox/style/font-weight"/>;</xsl:if>
  268.     <xsl:if test="./textbox/style/font-size">font-size:<xsl:value-of select="./textbox/style/font-size"/>;</xsl:if>
  269.     <xsl:if test="./textbox/style/font-style">font-style:<xsl:value-of select="./textbox/style/font-style"/>;</xsl:if>
  270.     <xsl:if test="./textbox/style/font-variant">font-variant:<xsl:value-of select="./textbox/style/font-variant"/>;</xsl:if>
  271.     <xsl:if test="./textbox/style/text-align">text-align:<xsl:value-of select="./textbox/style/text-align"/>;</xsl:if>
  272.     <xsl:if test="./textbox/style/text-decoration">text-decoration:<xsl:value-of select="./textbox/style/text-decoration"/>;</xsl:if>
  273.     <xsl:choose>
  274.         <xsl:when test="./textbox/style/color">
  275.             <xsl:text>color:</xsl:text><xsl:value-of select="./textbox/style/color"/><xsl:text>;</xsl:text>
  276.         </xsl:when>
  277.         <xsl:otherwise>
  278.             <xsl:text>color:#000000;</xsl:text>
  279.         </xsl:otherwise>
  280.     </xsl:choose>
  281.     <xsl:if test="./textbox/style/writing-mode">writing-mode:<xsl:value-of select="./textbox/style/writing-mode"/>;</xsl:if>
  282. </xsl:template>
  283.  
  284. <xsl:template match="style">position:absolute;left:<xsl:value-of select="./left"/>;top:<xsl:value-of select="./top"/>;width:<xsl:value-of select="./width"/>;height:<xsl:value-of select="./height"/>;<xsl:if test="./visibility">visibility:<xsl:value-of select="./visibility"/>;</xsl:if></xsl:template>
  285.  
  286. <xsl:template match="photofilepath">
  287.     <xsl:element name="v:imagedata">
  288.         <xsl:choose>
  289.             <xsl:when test=".!=''">
  290.                 <xsl:attribute name="src"><xsl:value-of select="."/></xsl:attribute>
  291.             </xsl:when>
  292.             <xsl:otherwise>
  293.             </xsl:otherwise>
  294.         </xsl:choose>                
  295.  
  296.         <xsl:if test="contains(../@photowidth, 'px') and contains(../@photoheight, 'px') and contains(../style/width, 'px') and contains(../style/height, 'px')">
  297.             <xsl:if test="number(translate(../@photowidth, 'px', '')) > 0 and number(translate(../@photoheight, 'px', '')) > 0 and number(translate(../style/width, 'px', '')) > 0 and number(translate(../style/height, 'px', '')) > 0">
  298.                 <xsl:choose>
  299.                     <xsl:when test="number(translate(../@photowidth, 'px', '')) * number(translate(../style/height, 'px', '')) > number(translate(../@photoheight, 'px', '')) * number(translate(../style/width, 'px', ''))">
  300.                         <xsl:attribute name="croptop"><xsl:value-of select="((number(translate(../@photoheight, 'px', '')) * number(translate(../style/width, 'px', ''))) - (number(translate(../@photowidth, 'px', '')) * number(translate(../style/height, 'px', '')))) div (2 * number(translate(../@photoheight, 'px', '')) * number(translate(../style/width, 'px', '')))"/></xsl:attribute>
  301.                         <xsl:attribute name="cropbottom"><xsl:value-of select="((number(translate(../@photoheight, 'px', '')) * number(translate(../style/width, 'px', ''))) - (number(translate(../@photowidth, 'px', '')) * number(translate(../style/height, 'px', '')))) div (2 * number(translate(../@photoheight, 'px', '')) * number(translate(../style/width, 'px', '')))"/></xsl:attribute>
  302.                     </xsl:when>
  303.                     <xsl:when test="number(translate(../@photoheight, 'px', '')) * number(translate(../style/width, 'px', '')) > number(translate(../@photowidth, 'px', '')) * number(translate(../style/height, 'px', ''))">
  304.                         <xsl:attribute name="cropleft"><xsl:value-of select="((number(translate(../@photowidth, 'px', '')) * number(translate(../style/height, 'px', ''))) - (number(translate(../@photoheight, 'px', '')) * number(translate(../style/width, 'px', '')))) div (2 * number(translate(../@photowidth, 'px', '')) * number(translate(../style/height, 'px', '')))"/></xsl:attribute>
  305.                         <xsl:attribute name="cropright"><xsl:value-of select="((number(translate(../@photowidth, 'px', '')) * number(translate(../style/height, 'px', ''))) - (number(translate(../@photoheight, 'px', '')) * number(translate(../style/width, 'px', '')))) div (2 * number(translate(../@photowidth, 'px', '')) * number(translate(../style/height, 'px', '')))"/></xsl:attribute>
  306.                     </xsl:when>
  307.                 </xsl:choose>
  308.             </xsl:if>
  309.         </xsl:if>
  310.     </xsl:element>
  311. </xsl:template>
  312.  
  313. <xsl:template match="imagedata">
  314.     <xsl:element name="v:imagedata">
  315.         <xsl:attribute name="src"><xsl:value-of select="./src"/></xsl:attribute>
  316.     </xsl:element>
  317. </xsl:template>
  318.  
  319. <xsl:template match="rowdata">
  320.     <xsl:call-template name="encodeNbsp">
  321.         <xsl:with-param name="text" select="."/>
  322.     </xsl:call-template>
  323.     <xsl:if test="boolean(number(@nextrow))">
  324.         <xsl:element name="br"/>
  325.     </xsl:if>
  326. </xsl:template>
  327.  
  328. <xsl:template name="encodeNbsp">
  329.     <xsl:param name="text"/>
  330.     <xsl:choose>
  331.         <xsl:when test="contains($text, ' ')">
  332.             <xsl:call-template name="encodeCRLF">
  333.                 <xsl:with-param name="text" select="substring-before($text, ' ')"/>
  334.             </xsl:call-template>
  335.  
  336.             <xsl:text disable-output-escaping="yes">&#160;</xsl:text>
  337.  
  338.             <xsl:call-template name="encodeNbsp">
  339.                 <xsl:with-param name="text" select="substring-after($text, ' ')"/>
  340.             </xsl:call-template>
  341.         </xsl:when>
  342.         <xsl:otherwise>
  343.             <xsl:call-template name="encodeCRLF">
  344.                 <xsl:with-param name="text" select="$text"/>
  345.             </xsl:call-template>
  346.         </xsl:otherwise>
  347.     </xsl:choose>
  348. </xsl:template>
  349.  
  350. <xsl:template name="encodeCRLF">
  351.     <xsl:param name="text"/>
  352.     <xsl:choose>
  353.         <xsl:when test="contains($text, ' ')">
  354.             <xsl:value-of select="substring-before($text, ' ')"/>
  355.             <xsl:element name="br"/>
  356.             <xsl:call-template name="encodeCRLF">
  357.                 <xsl:with-param name="text" select="substring-after($text, ' ')"/>
  358.             </xsl:call-template>
  359.         </xsl:when>
  360.         <xsl:otherwise>
  361.             <xsl:value-of select="$text" />
  362.         </xsl:otherwise>
  363.     </xsl:choose>
  364. </xsl:template>
  365.  
  366. </xsl:stylesheet>
  367.